﻿using AutoMapper;
using Chat_IService;
using Chat_Model;
using Chat_Model.ViewModel;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;


namespace Chat_WebApi.Controllers
{
    public class BaseController : Controller
    {
        /// <summary>
        /// 请求错误
        /// </summary>
        protected MessageModel<object> Error(string message = "")
        {
            return new MessageModel<object>()
            {
                Code = (int)HttpStatusCode.Forbidden,
                Message = message,
            };
        }

        /// <summary>
        /// 请求成功
        /// </summary>
        protected MessageModel<object> Success(string message, object data)
        {
            return new MessageModel<object>()
            {
                Code = (int)HttpStatusCode.OK,
                Message = message,
                Data = data,
            };
        }
        /// <summary>
        /// 请求成功
        /// </summary>
        protected MessageModel<object> Success(object data)
        {
            return new MessageModel<object>()
            {
                Code = (int)HttpStatusCode.OK,
                Data = data,
            };
        }
        /// <summary>
        /// 请求成功
        /// </summary>
        protected MessageModel<object> Success()
        {
            return new MessageModel<object>()
            {
                Code = (int)HttpStatusCode.OK,
            };
        }
    }
}
